//
//  SevenChapterViewController.m
//  CoreAnimation
//
//  Created by 张国文 on 16/10/26.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "SevenChapterViewController.h"
#import "CABasicAnimationViewController.h"
#import "CABasicAnimationMakeUpClockViewController.h"
#import "CAKeyFrameAnimationViewController.h"
#import "CAAnimationGroupViewController.h"
#import "CATransitionViewController.h"
#import "CATransitionOnUITabbarViewController.h"
#import "CustomTransitionAnimationViewController.h"
#import "StopAnimationViewController.h"

@interface SevenChapterViewController ()

@end

@implementation SevenChapterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIButton *firstButton = [UIButton buttonWithType:UIButtonTypeCustom];
    firstButton.frame = CGRectMake(0, 20, 300, 50);
    [firstButton setTitle:@"CABasicAnimation代理" forState:UIControlStateNormal];
    [firstButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    firstButton.tag = 100;
    [firstButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:firstButton];
    
    UIButton *sectionButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sectionButton.frame = CGRectMake(0, 70, 300, 50);
    [sectionButton setTitle:@"CABasicAnimation制作时钟" forState:UIControlStateNormal];
    [sectionButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    sectionButton.tag = 101;
    [sectionButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sectionButton];
    
    
    UIButton *thirdButton = [UIButton buttonWithType:UIButtonTypeCustom];
    thirdButton.frame = CGRectMake(0, 120, 300, 50);
    [thirdButton setTitle:@"CAKeyFrameAnimation" forState:UIControlStateNormal];
    [thirdButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    thirdButton.tag = 102;
    [thirdButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:thirdButton];
//
    UIButton *fourthButton = [UIButton buttonWithType:UIButtonTypeCustom];
    fourthButton.frame = CGRectMake(0, 170, 300, 50);
    [fourthButton setTitle:@"CAAnimationGroup" forState:UIControlStateNormal];
    [fourthButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    fourthButton.tag = 103;
    [fourthButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:fourthButton];
//
    UIButton *fivethButton = [UIButton buttonWithType:UIButtonTypeCustom];
    fivethButton.frame = CGRectMake(0, 220, 300, 50);
    [fivethButton setTitle:@"CATransition-过渡" forState:UIControlStateNormal];
    [fivethButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    fivethButton.tag = 104;
    [fivethButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:fivethButton];
//    //
    UIButton *sixthButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sixthButton.frame = CGRectMake(0, 270, 360, 50);
    [sixthButton setTitle:@"CATransition作用于UITabbarController" forState:UIControlStateNormal];
    [sixthButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    sixthButton.tag = 105;
    [sixthButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sixthButton];
//    //
    UIButton *sevenButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sevenButton.frame = CGRectMake(0, 320, 300, 50);
    [sevenButton setTitle:@"控制器的自定义过渡动画" forState:UIControlStateNormal];
    [sevenButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    sevenButton.tag = 106;
    [sevenButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sevenButton];
    
    UIButton *eightButton = [UIButton buttonWithType:UIButtonTypeCustom];
    eightButton.frame = CGRectMake(0, 370, 300, 50);
    [eightButton setTitle:@"在动画过程中移除动画" forState:UIControlStateNormal];
    [eightButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    eightButton.tag = 107;
    [eightButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:eightButton];
}

- (void)clickJump:(UIButton *)button
{
    switch (button.tag) {
        case 100:
        {
            CABasicAnimationViewController *caBasicAnimationVC = [[CABasicAnimationViewController alloc] init];
            [self.navigationController pushViewController:caBasicAnimationVC animated:YES];
            break;
        }
        case 101:
        {
            CABasicAnimationMakeUpClockViewController *clockVC = [[CABasicAnimationMakeUpClockViewController alloc] init];
            [self.navigationController pushViewController:clockVC animated:YES];
            break;
        }
        case 102:
        {
            CAKeyFrameAnimationViewController *caKeyFrameAnimationVC = [[CAKeyFrameAnimationViewController alloc] init];
            [self.navigationController pushViewController:caKeyFrameAnimationVC animated:YES];
            break;
        }
        case 103:
        {
            CAAnimationGroupViewController *caAnimationGroupVC = [[CAAnimationGroupViewController alloc] init];
            [self.navigationController pushViewController:caAnimationGroupVC animated:YES];
            break;
        }
        case 104:
        {
            CATransitionViewController *caTransitionVC = [[CATransitionViewController alloc] init];
            [self.navigationController pushViewController:caTransitionVC animated:YES];
            break;
        }
        case 105:
        {
            CATransitionOnUITabbarViewController *caTransitionOnUITabbarVC = [[CATransitionOnUITabbarViewController alloc] init];
            [self.navigationController pushViewController:caTransitionOnUITabbarVC animated:YES];
            break;
        }
        case 106:
        {
            CustomTransitionAnimationViewController *customTransitionAnimationVC = [[CustomTransitionAnimationViewController alloc] init];
            [self.navigationController pushViewController:customTransitionAnimationVC animated:YES];
            break;
        }
            case 107:
        {
            StopAnimationViewController *stopAnimationVC = [[StopAnimationViewController alloc] init];
            [self.navigationController pushViewController:stopAnimationVC animated:YES];
            break;
        }
        default:
            break;
    }
}



@end
